import request from '@/utils/request'
import { tokenName } from '@/config'

/**
 * 用户登录
 * @param {*} data 
 * @returns 
 */
export async function login(data) {
  return request({
    url: '/auth/login',
    method: 'post',
    data
  })
}

export async function socialLogin(data) {
  return request({
    url: '/socialLogin',
    method: 'post',
    data,
  })
}

export function getUserInfo() {
  //此处为了兼容mock.js使用data传递accessToken，如果使用mock可以走headers
  return request({
    url: '/adminInfo',
    method: 'get',
  })
}

/**
 * 用户信息修改
 * @param {y} data 
 * @returns 
 */
 export async function userModify(data) {
  return request({
    url: '/modifyAdminInfo',
    method: 'put',
    data:data
  })
}


export function logout() {
  return request({
    url: '/logout',
    method: 'post',
  })
}

export function register() {
  return request({
    url: '/register',
    method: 'post',
  })
}
